package Student;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Partitioner;

public class Partition extends Partitioner<Students, NullWritable> {
    public int getPartition(Students students, NullWritable nullWritable, int numPartitions) {
        if ("男".equals(students.getSex())) {
            if (students.getClassName().startsWith("文")) {
                return 0;
            }
            return 1;
        } else {
            if (students.getClassName().startsWith("理")) {
                return 2;
            }
            return 3;
        }
    }
}
